/*
 * lista.h
 *
 *  Created on: 19/10/2011
 *      Author: Pablo Arias & Juan Pablo De Blas
 */

#ifndef LISTA_H_
#define LISTA_H_

#include <stdio.h>

#include <semaphore.h>
#include "collections.h"

#define _XOPEN_SOURCE 500

struct uNodo{

    unsigned int info;
    struct uNodo *sig;
} typedef uNodo;


struct Nodo{

    int info;
    struct Nodo *sig;

} typedef Nodo;

void add_int(Nodo **lst, int valor);
void add_uint(uNodo **lst, unsigned int valor);
void printList_int(Nodo *lst);
int unqueue(Nodo **lst);
unsigned int unquenue_u(uNodo**lst);



typedef enum
{
	NOMODIFICADO = 0,
	MODIFICADO = 1,
} bitMod;

struct t_cache {

	unsigned int	sector;
	char 			buffer[512]; //512 bytes
	time_t 			*timeStand;
	bitMod 			modificado;
	struct t_cache	*siguiente;
};

struct TDD_entry {

	const char 			*path;
	struct t_cache 		*cache;
	int					cantSecEnCache;
	pthread_mutex_t 	mutexCache;
    struct TDD_entry 	*siguiente;
};

void agregarEntradaTDD(const char *path);

void insertarEnTDD(struct TDD_entry **TDD, struct TDD_entry *newArch);

struct TDD_entry *buscarEnTDD(const char *path, struct TDD_entry *ant);

void liberarNodoPath(struct TDD_entry **TDD, struct TDD_entry *nodoAnterior);

void clearTDD(void);

#endif /* LISTA_H_ */
